package cn.desk.linksource.entity;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import cn.desk.commons.entity.LogicallyDelete;


@Entity
@Table(name="t_linksource")
public class LinkSource extends LogicallyDelete {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	private String id;
	/**
	 * 
	 */
	private Integer sourceType;
	private Integer disOrder;
	public static final int JAVASCRIPT = 0,CSS=1;
	private transient String sourceTypeName;
	public LinkSource() {
	}
	/**
	 * @param sourceType the sourceType to set
	 */
	public void setSourceType(Integer sourceType) {
		this.sourceType = sourceType;
	}

	/**
	 * @return the sourceType
	 */
	public Integer getSourceType() {
		return sourceType;
	}

	/**
	 * @param disOrder the disOrder to set
	 */
	public void setDisOrder(Integer disOrder) {
		this.disOrder = disOrder;
	}

	/**
	 * @return the disOrder
	 */
	public Integer getDisOrder() {
		return disOrder;
	}

	/**
	 * @param sourceTypeName the sourceTypeName to set
	 */
	public void setSourceTypeName(String sourceTypeName) {
		this.sourceTypeName = sourceTypeName;
	}

	/**
	 * @return the sourceTypeName
	 */
	@Transient
	public String getDisplaySourceType() {
		if(sourceType==null){
			return "";
		}
		switch (sourceType) {
		case CSS:
			return "CSS";
		case JAVASCRIPT:
			return "JAVASCRIPT";
		}
		return sourceTypeName;
	}

	@Override
	@Transient
	public Object getValue() {
		return getId();
	}

	@Override
	@Transient
	public String getDisplayName() {
		return "资源文件";
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
}
